/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date        Author       Notes
 * 2025-2-8     金鹏      the first version
 */
#ifndef JPCMN_UART_CMN_UART_H_
#define JPCMN_UART_CMN_UART_H_

#include "JpCMN/DEFINE/DEFINE.h"
#include "JpCMN/JSON/json.h"
#include <rtthread.h>
#include <rtdef.h>
#include "drv_usart.h"

struct CMN_UART
{
    rt_device_t uart_serial;                             /* 串口设备句柄*/
    rt_sem_t uart_rx_sem;                                /* 串口接收信号量*/
    rt_err_t (*input)(rt_device_t, rt_size_t);           /* 串口回调函数*/
};

ENTRY CMN_Uart_Init(char *name);
static rt_err_t uart1_input(rt_device_t dev, rt_size_t size);
static rt_err_t uart2_input(rt_device_t dev, rt_size_t size);
static rt_err_t uart3_input(rt_device_t dev, rt_size_t size);
static rt_err_t uart4_input(rt_device_t dev, rt_size_t size);
static rt_err_t uart5_input(rt_device_t dev, rt_size_t size);
static rt_err_t uart6_input(rt_device_t dev, rt_size_t size);
static void BAUD_Change(rt_device_t *device , int baudrate);

#endif /* JPCMN_UART_CMN_UART_H_ */
